<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCouponTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupon', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();

            $table->string('name')->comment('优惠券描述');

            $table->integer('num')->unsigned()->comment('发放数量');

            $table->integer('type')->unsigned()->comment('优惠方式，1是指定金额，2是折扣');

            $table->decimal('money')->unsigned()->default(0.00)->comment('指定金额的优惠券面值');

            $table->decimal('discount')->unsigned()->default(10.00)->comment('优惠券折扣');

            $table->integer('condition')->unsigned()->comment('门槛类型，2是满减，1无门槛');

            $table->integer('coupon_rule_id')->unsigned()->comment('优惠券规则表id');

            $table->decimal('condition_money')->unsigned()->nullable()->comment('满减门槛金额');






        });

        DB::statement("ALTER TABLE `coupon` COMMENT='优惠券表'");//表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupon');
    }
}
